package com.heima.article.articlecontroller;

import com.heima.article.service.AuthorService;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/author")
public class AuthorController {

    @Autowired
    private AuthorService authorService;


    @GetMapping("/findByUserId/{id}")
    public ResponseResult<ApAuthor> selectbyid(@PathVariable("id") Integer id) {
        return authorService.findbyuserid(id);
    }

    @PostMapping("save")
    public ResponseResult<ApAuthor> saveapauthor(@RequestBody ApAuthor apAuthor) {
        return authorService.saveapauthor(apAuthor);

    }
}
